package com.logansoft.zhxypkoa.repository.sys;

import java.util.Optional;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import com.logansoft.zhxypkoa.domain.sys.Resource;

@RepositoryRestResource(collectionResourceRel = "resources", path = "resources")
public interface ResourceRepository extends JpaRepository<Resource, String> {
	@Cacheable(value = "resources", key = "#p0")
	@Override
	Page<Resource> findAll(Pageable pageable);
	@CacheEvict(value = "resources", key = "#p0.id", allEntries = true)
	@Override
	<S extends Resource> S save(S entity);
	@Cacheable(value = "resources", key = "#p0")
	@Override
	Optional<Resource> findById(String id);
	@CacheEvict(value = "resources", key = "#p0", allEntries = true)
	@Override
	void deleteById(String id);
	@CacheEvict(value = "resources", key = "#p0.id", allEntries = true)
	@Override
	void delete(Resource entity);

}
